$(document).ready(function(e) {

    var pager_id = '#pager_hold';
    var search_list = '#paging_cont';
    var sort_by_container = '#sort_by';
    var filter_trigger = $('.filterelement');

    API.Data.IS_FILTERING = false;

    var effects_manager = new API.x_effect.EffectsManager("#results");
    var sorter_manager = new API.x_sorter.SorterManager(sort_by_container);
    var pager_manager = new API.x_pager.PagerManager("#results", search_list, effects_manager);
    var slider_manager = new API.x_slider.SliderManager(effects_manager, ".slider", search_list);

    var references = {
        'effects_manager': effects_manager,
        'slider_manager': slider_manager,
        'sorter_manager': sorter_manager,
        'pager_manager': pager_manager
    };

    var filter = new API.x_filter.FilterManager(filter_trigger, search_list, items, sort_by_container, references);

    filter.initialize();

    $('.show_more').on('click', showMe);
    
     $.each(items, function(n, item) {   // idemo kroz objekte
        var index = 0;
        $.each(item.photos, function(n, photo) {   // idemo kroz slike
            var thumb = API.Data.HOST_URL_HOTELS + photo.path + '/thumb_182x123/' + photo.photo_name;
            var img = $('<img>'); //Equivalent: $(document.createElement('img'))
            img.attr('src', thumb);
            img.attr('alt', photo.photo_title);
            img.appendTo('#box-' + item.object_ID + ' .carousel .carousel-inner .item:eq(' + index + ') a');
            index++;

        });
    });  // Load Images
    
    console.log($('#fake-loader'));
                    
                    $('#fake-loader').remove();

});